package chapter23.homework03;

public class Expert extends State {
    public Expert(State kil){
        this.player = kil.player;
        this.rankName = "专家";
        this.point = kil.point;
    }

    @Override
    public void checkState(int point) {
        if(  point >= 100 &&point < 1000){
            player.setState(new Killer(this));
            //当积分小于1000大于等于100是时返回到高手状态...
        }else if(point < 100){
            player.setState(new Primary(this));
            //当积分小于100时返回为新手状态...
        }
    }

    @Override
    public void LeavingMessage() {
        System.out.println(rankName + "用户留言" + player.getName() + "积分翻倍+30 ");
        //实现积分翻倍，进入下一关...
        point += 30;
        checkState(point);
    }

    @Override
    public void reply() {//回复
        System.out.println(rankName + "用户回复消息..." );
    }

    @Override
    public void download() {//下载
        if (point < 0){
            System.out.println("无法下载文件...");
        }
        int count = 10;
        point -= count / 2;
        System.out.println(rankName + "下载文件后积分还剩" + point);
    }
}